﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using coliseu.BussinessLayer;

namespace coliseu.Views.Servicos
{
    public partial class FrmListFornecedor : Form
    {
        private FornecedorBL bl = new FornecedorBL();
        private Tipo_servicoBL tbl = new Tipo_servicoBL();

        public FrmListFornecedor()
        {
            InitializeComponent();
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            pnlFundo.Visible = true;
        }

        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            pnlFundo.Visible = false;
        }

        private void FrmListFornecedor_Load(object sender, EventArgs e)
        {
            tiposervicoBindingSource.DataSource = tbl.selecionar();
            fornecedorBindingSource.DataSource = bl.selecionar();            
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Deseja excluir?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                bl.excluir((fornecedor)fornecedorBindingSource.Current);
                fornecedorBindingSource.DataSource = bl.selecionar();
            }
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            FrmCadFornecedor c = new FrmCadFornecedor(bl, ((fornecedor)fornecedorBindingSource.Current));
            c.ShowDialog();
            fornecedorBindingSource.DataSource = bl.selecionar();
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            FrmCadFornecedor c = new FrmCadFornecedor(bl);
            c.ShowDialog();
            fornecedorBindingSource.DataSource = bl.selecionar();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            fornecedorBindingSource.DataSource = bl.selecionar(txtBloco.Text, Convert.ToInt32(comboBox1.SelectedValue));
            pnlFundo.Visible = false;
        }
    }
}
